package main

import (
	"fmt"
	"sync"
)

type Person struct {
	Name  string
	Alive bool
}

func Kill(p *Person) {
	p.Alive = false
	fmt.Println("杀死" + p.Name + "成功\n")
}
func main() {
	var Bill = &Person{"bill", true}
	var wg sync.WaitGroup
	var once sync.Once
	for i := 0; i < 10; i++ {
		wg.Add(1)
		go func() {
			once.Do(func() {
				Kill(Bill)
			})
			wg.Done()
		}()
	}
	wg.Wait()
	fmt.Println(*Bill)
	fmt.Println("main over")
}
